import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";

import { fetchInfo } from "./actions";
import { selectLoading } from "./reducers";

import Loading from "./Loading";

export default function App() {
  const dispatch = useDispatch();
  const loading = useSelector(selectLoading);

  useEffect(() => {
    dispatch(fetchInfo());
  }, [dispatch]);

  return <Loading loading={loading} />;
}
